﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int N = 3, M = 3, sum = 0;
	scanf("%d %d", &N, &M);
	int a[3][3] = { 0 };
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < M; j++)
		{
			scanf("%d", &a[i][j]);
		}
		printf("\n");
	}
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < M; j++)
		{
			if (a[i][j] > 0)
				sum += a[i][j];
		}

	}
	printf("%d", sum);

	return 0;
}

